<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path;
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
<title>每周点评详情-云校通</title>
<style type="text/css">
	@media screen and (max-width:320px){
		  .thumbnail {
		  		width: 85px !important;
		  		height: 85px !important;
		  }
		}
	@media screen and (max-width:360px){
		  .thumbnail {
		  		width: 105px !important;
		  		height: 105px !important;
		  }
		}
</style>
<jsp:include page="/WEB-INF/page/common/_header.jsp"></jsp:include>
<body ontouchstart id="week-comment-detail">
	<div class="weui_tab tab-bottom">
		<div class="weui-header bg-blue"> 
	  		<div class="weui-header-left"> <a onclick="back()" href="javascript:" class="icon icon-109 f-white">返回</a> </div>
	    	<h1 class="weui-header-title">每周点评详情</h1>
	    	<c:if test="${user.roleType == 1 && isEdit }">
	    		<div class="weui-header-right"> 
	    			<a href="<%=basePath %>/ls/week/comment/write?sid=${detail.studentId }&wno=${detail.weekNo }&cid=${detail.id}" class="f-white">修改</a>
	    		</div>
	    	</c:if>
	    	<c:if test="${user.roleType == 0 && isEdit }">
	    		<div class="weui-header-right"> 
	    			<a href="<%=basePath %>/xs/week/comment/detail/${detail.id }?sid=${detail.studentId}&edit=1" class="f-white">修改</a>
	    		</div>
	    	</c:if>
	    </div>
		<div class="weui_tab_bd">
			<div class="dianping">
			    <ul id="teacherTypeList">
			    </ul>
			</div>
			<div class="pingyu1">
			    <header>
			      <img src="<%=basePath %>/images/iconZ.png">
			      <h4>${detail.studentName }的老师 第${detail.weekNo }周评语</h4>
			    </header>
			    <p class="artical">${detail.teacherCommentContent }</p>
			    <c:if test="${detail.attachList != null}">
			    <div class="weui_cells mt0">
			    	<div class="weui_cell moments__post" style="padding: 0;">
	          			<div class="weui_cell_bd">
	            			<div class="thumbnails img-click">
		            			<c:forEach var="itm" items="${detail.attachList }">
		            				<c:if test="${itm.teacherId != null }">
			            				<div class="thumbnail">
			            					<img class="weui_media_appmsg_thumb" onclick="imgClick(this)" src="${config.imgUrl}${itm.attachmentUrl }"/>
			            				</div>
		            				</c:if>
		            			</c:forEach>
	          				</div>
	        			</div>
	        		</div>
                </div>
                </c:if>
			</div>
			<c:if test="${detail.status == 2 }">
				<div class="pingyu1">
				    <header>
				      <img src="<%=basePath %>/images/iconZ.png">
				      <h4>学生自评</h4>
				    </header>
				    <div class="dianping pb0" id="studentComment">
				    	
				    </div>
				</div>
				<div class="pingyu1 mb55">
				    <header>
				      <img src="<%=basePath %>/images/iconZ.png">
				      <h4>家长回评</h4>
				    </header>
				    <div class="dianping">
				      <ul id="parentTypeList">
				      </ul>
					</div>
					<p class="artical">${detail.parentCommentContent}</p>
					<c:if test="${detail.attachList != null}">
				    <div class="weui_cells mt0 afterNoneBefore borderNoneBefore">
				    	<div class="weui_cell moments__post" style="padding: 0;">
		          			<div class="weui_cell_bd">
		            			<div class="thumbnails img-click">
			            			<c:forEach var="itm" items="${detail.attachList }">
			            				<c:if test="${itm.parentStudentRelId != null }">
				            				<div class="thumbnail">
				            					<img class="weui_media_appmsg_thumb" onclick="imgClick(this)" src="${config.imgUrl}${itm.attachmentUrl }"/>
				            				</div>
			            				</c:if>
			            			</c:forEach>
		          				</div>
		        			</div>
		        		</div>
	                </div>
	                </c:if>
				</div>
			</c:if>
		</div>
	</div>
	<input type="hidden" id="studentCommentContent" value="${detail.studentCommentContent}"/>
</body>
<script type="text/javascript">
	$(function() {
		init();
	})
	function init() {
		initTypeHtml("${detail.teacherCommentType}", "teacherTypeList");
		if("${detail.status}" == "2") {
			initTypeHtml("${detail.parentCommentType}", "parentTypeList");
			initStudentCommentHtml($("#studentCommentContent").val());
		}
	}
	function initStudentCommentHtml(studentComment) {
		var array = studentComment.split("b,b");
		var html = "";
		for(var i in array) {
			var array1 = array[i].split("a|a");
			html += '<div class="weui_cells weui_cells_form mt0">\
	    		<div class="weui_cells_title f-green">'+array1[0]+'</div>\
	            <div class="weui_cell">\
	                <div class="weui_cell_bd weui_cell_primary">\
	                     <p style="width: 100%;margin-left: 0;margin-top: 5px;">'+array1[1]+'</p>\
	                </div>\
	            </div>\
	        </div>'
		}
		$("#studentComment").html(html);
	}
	function initTypeHtml(commentType, id) {
		var teaTypeList = commentType.split(",");
		var teaTypeHtml = "";
		for(var i in teaTypeList) {
			var itm = teaTypeList[i];
			var array = itm.split("|");
			teaTypeHtml += '<li>\
		        <img src="<%=basePath%>/images/iconJ.png"><p>'+array[0]+'</p>\
		        <div class="star-box">\
		          <span class="icon'+(parseInt(array[1]) >= 1 ? " icon-48 f-red" : " icon-49")+'"></span>\
		          <span class="icon'+(parseInt(array[1]) >= 2 ? " icon-48 f-red" : " icon-49")+'"></span>\
		          <span class="icon'+(parseInt(array[1]) >= 3 ? " icon-48 f-red" : " icon-49")+'"></span>\
		          <span class="icon'+(parseInt(array[1]) >= 4 ? " icon-48 f-red" : " icon-49")+'"></span>\
		          <span class="icon'+(parseInt(array[1]) >= 5 ? " icon-48 f-red" : " icon-49")+'"></span>\
		        </div>\
		      </li>';
		}
		$("#" + id).html(teaTypeHtml);
	}
</script>
<jsp:include page="/WEB-INF/page/common/_footer.jsp"></jsp:include>
</html>